package com.example.demo.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ${lgs} on 2018/7/25
 */
@ControllerAdvice
public class HandlerException {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public String handlerException(HttpServletRequest req, Exception e) {
        //是返回的String
        return "对不起，偶要打酱油去了!!!";
    }
}
